package csu.rjxyg.action.userAction;

import java.io.IOException;

import com.mongodb.BasicDBList;

import csu.rjxyg.action.BaseAction;
import csu.rjxyg.bean.core.BaseObject;
import csu.rjxyg.dao.BaseDaoAdapter;
import csu.rjxyg.action.constant.CourseConstant;
import csu.rjxyg.action.constant.UserConstant;
import csu.rjxyg.factory.core.DaoFactory;
import csu.rjxyg.factory.core.UtilFactory;
import csu.rjxyg.service.BaseUserService;
import csu.rjxyg.util.LogUtil;

/**
 * URL：DeleteUser(.action)
 * 提交：删除的账号id 参数为String[] userIdArray
 * 返回：{"result":"success"}或者{"result":"error"}
 * @author chenzuhuang
 * 未测试
 */
public class DeleteUserAction extends BaseAction {
	private LogUtil log;
	
	private String[] userIdList;
	
	public DeleteUserAction(){
		this.log = UtilFactory.getLogUtil(this.getClass());
	}
	
	public void deleteUserBean() throws Exception{
		if (userIdList == null) {
			this.out("error:请选择要删除的项！");
			return;
		}
		BaseDaoAdapter userDao = DaoFactory
				.getDaoByColName(UserConstant.COLLECTION_NAME);
		if (userDao.deleteBean(userIdList)) {
			this.out("success");
		} else {
			this.out("删除失败！请联系服务提供商");
		}
	}

	public String[] getUserIdList() {
		return userIdList;
	}

	public void setUserIdList(String[] userIdList) {
		this.userIdList = userIdList;
	}

}
